package cool.tianyou.blue.bird.constant;

import android.content.Context;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import cool.tianyou.blue.bird.Filter;
import cool.tianyou.blue.bird.activity.LoginActivity;
import cool.tianyou.blue.bird.activity.MainActivity;
import cool.tianyou.blue.bird.model.PushedNotification;
import cool.tianyou.blue.bird.model.dto.LoginDTO;
import cool.tianyou.blue.bird.service.MQTTService;
import cool.tianyou.blue.bird.util.SpUtil;
import okhttp3.MediaType;

public class Constant {
        public static final String DOMAIN = "dove.i-todo.top";
//    public static final String DOMAIN = "192.168.3.17:10996";
    //    public static final String DOMAIN = "192.168.3.17:4523/mock/576837";
    public static final ConcurrentHashMap<Integer, PushedNotification> PUSHED_NOTIFICATION_ID = new ConcurrentHashMap<>();


    public static final class SP_CONSTANT {
        public static final String USER_ID = "user_id";
        public static final String TOKEN = "token";
        public static final String DEVICE_ID = "device_id";
        public static final String MESSAGE_PUSH_STATUS = "MESSAGE_PUSH_STATUS";
    }

    public static final class USER_INFO {
        public static String USER_ID;
        public static String TOKEN;
        public static String DEVICE_INFO;
        public static String BRAND;
        public static String MODEL;
    }


    public static void saveUserInfo(LoginDTO loginDTO, Context context) {
        SpUtil.putString(context, Constant.SP_CONSTANT.TOKEN, loginDTO.getToken());
        SpUtil.putString(context, Constant.SP_CONSTANT.USER_ID, loginDTO.getUserId().toString());
        Constant.USER_INFO.TOKEN = loginDTO.getToken();
        Constant.USER_INFO.USER_ID = loginDTO.getUserId().toString();
    }


    public static MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");

    public static List<Filter> defaultFilters = Arrays.asList(
            Filter.createWithPlanText("com.android.mms", null, null),
            Filter.createWithPlanText("com.android.email", null, null),
            Filter.createWithPlanText("android", null, null)
    );
}
